import java.util.*;

public class Player
{
    private int strength=100;
    private Map<String, Thing > bag = new HashMap<>();
    public void step(){
        strength-=5;
        System.out.println("现在能量值为："+strength);
    }
    
    public void pick(Thing thing){
            bag.put(thing.getName(),thing);
    }
    
    public void eat(String name){
        Thing thing =bag.get(name);
        if(thing!= null){
            strength += thing.getEnergy();
            System.out.println("你吃了这"+thing.getName());
            bag.remove(name);
            if(strength>100){
                strength =100;
            }
        }
    }
    
    public boolean isDead(){
        return strength <=0;
    }
    
    public void check(){
        System.out.print("这个包里有: ");
        for(String key : bag.keySet())
            System.out.print(bag.get(key).getName()+" ");
        System.out.println("");
    }
    
    public void isGet(){
        for(String key : bag.keySet())
        {
            if(bag.get(key).getName().equals("宝箱"))
            {
                System.out.println("不愧是你，竟然能找到了宝箱");
                System.out.println("你将会得到我的祝福，在遇难时会化险为夷");
                break;
            }
        }
    }
    
   
}
